import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';
import { saveValidate } from 'src/hrpub/common/utils/utils';
export default async function saveNewInfo() {
    const {orgVal, form, onSure} = this.props;

    let postData = {
        ifSynWork: this.state.isSynWork,
        model: form.getAllFormValue('parttime'),
        pk_org: orgVal && orgVal.refpk,
        pk_psnjob: form.getFormItemsValue('partadd', 'pk_psnjob').value
    };

    let callback = () => {
        return proFetch({
            url: '/nccloud/hrtrn/partrds/PartRdsAddSaveAction.do',
            body: postData,
        })
            .then((res) => {
                if (res.success) {
                    this.closeModal();
                    onSure();
                }
            });
    };
    await saveValidate(
        this.props,
        this.props.pagecode,
        'parttime',
        [],
        'form',
        null,
        null
    );
    callback();
    /*this.props.validateToSave({
        parttime: form.getAllFormValue('parttime')
    }, callback, {}, 'form');*/
}
